// Decompiled by Jad v1.5.8g. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://www.kpdus.com/jad.html
// Decompiler options: packimports(3)
// Source File Name:   Tyg_txQuery1.java


//Changing this program to allow update

package MaintMenu.VenPricingUpdTBLN;

import MaintMenu.PoAnalysis.CostCal;

import java.sql.*;

public class test2tbl {

    public  test2tbl(){
        try {
            double cuftCost=2.5D;               //**** CUFT Cost $2.5 per cuft
            CostCal dnk = new CostCal();
            Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
            String dataSourceName = "dbLI";
            String dbURL = (new StringBuilder()).append("jdbc:odbc:").append(dataSourceName).toString();
            Connection con = DriverManager.getConnection(dbURL, "", "");
            Statement st = con.createStatement();
//            System.out.println("1");

            try {

                st.execute("SELECT * FROM _costdepo2");
                ResultSet rs = st.getResultSet();
//                System.out.println("resultset ran");
                if (rs != null)
                    while (rs.next()) {
//                        String dnknum = rs.getString("dnk#");
                        String pl = rs.getString("partslink1");
                        String capa = rs.getString("CAPA");
                        System.out.println(" "+pl+" "+capa);
//                        System.out.println("end");


//                        double tw_shipCost = rs.getDouble("tyg_tw_c")*cuftCost;
//                        double tw = rs.getDouble("tyg_tw_p")+tw_shipCost;
//
//                        double tx = rs.getDouble("tyg_tx_p");
//
//                        double gd_shipCost = rs.getDouble("gd_c")*cuftCost;
//                        double gd = rs.getDouble("gd_p")+gd_shipCost;
//
//                        double pt_shipCost = rs.getDouble("protec_c")*cuftCost;
//                        double pt = rs.getDouble("protec_p")+pt_shipCost;


//                        String supplier=" ";

//                        try {
////                            supplier = dnk.comparePrice(pt,0.00D,tx,0.00D,tw,gd,0.00D);
//                            System.out.println("Supplier :"+supplier);
//                            String sql="UPDATE tblbcn_tempout2 SET supplier = '"+supplier+"' WHERE partlink = '"+plNum+"'";
//                            System.out.println(sql);
//                            int rowupd = st.executeUpdate(sql);
//                            System.out.println("Total Record Updated :"+rowupd);
//
////                            st.execute((new StringBuilder()).append("update TBLBCN set REMARK = REMARK & ' ' & '").append(a).append("' WHERE [PART#] = '").append(b).append("';").toString());
//                        } catch (SQLException er) {
                        }


            } catch (SQLException e) {
                e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
            }
        } catch (ClassNotFoundException e) {
            e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
        } catch (SQLException e) {
            e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
        }
    }
}
//
//// Decompiled by Jad v1.5.8g. Copyright 2001 Pavel Kouznetsov.
//// Jad home page: http://www.kpdus.com/jad.html
//// Decompiler options: packimports(3)
//// Source File Name:   Tyg_txQuery1.java
//
//
////Changing this program to allow update
//
//package MaintMenu.VenPricingUpdTBLN;
//
//import MaintMenu.PoAnalysis.CostCal;
//
//import java.sql.*;
//
//public class test2tbl {
//
//    public void getBestPrice(){
//        try {
//            double cuftCost=2.5D;               //**** CUFT Cost $2.5 per cuft
//            CostCal dnk = new CostCal();
//            Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
//            String dataSourceName = "dbLI";
//            String dbURL = (new StringBuilder()).append("jdbc:odbc:").append(dataSourceName).toString();
//            Connection con = DriverManager.getConnection(dbURL, "", "");
//            Statement st = con.createStatement();
//
//            try {
//
//                st.execute("SELECT * FROM tblbcn_tempout2;");
//                ResultSet rs = st.getResultSet();
//                if (rs != null)
//                    while (rs.next()) {
//
//
//                        String plNum = rs.getString("Partlink");
//
//                        double tw_shipCost = rs.getDouble("tyg_tw_c")*cuftCost;
//                        double tw = rs.getDouble("tyg_tw_p")+tw_shipCost;
//
//                        double tx = rs.getDouble("tyg_tx_p");
//
//                        double gd_shipCost = rs.getDouble("gd_c")*cuftCost;
//                        double gd = rs.getDouble("gd_p")+gd_shipCost;
//
//                        double pt_shipCost = rs.getDouble("protec_c")*cuftCost;
//                        double pt = rs.getDouble("protec_p")+pt_shipCost;
//
//
//                        String supplier=" ";
//
//                        try {
////                            supplier = dnk.comparePrice(pt,0.00D,tx,0.00D,tw,gd,0.00D);
//                            System.out.println("Supplier :"+supplier);
//                            String sql="UPDATE tblbcn_tempout2 SET supplier = '"+supplier+"' WHERE partlink = '"+plNum+"'";
//                            System.out.println(sql);
//                            int rowupd = st.executeUpdate(sql);
//                            System.out.println("Total Record Updated :"+rowupd);
//
////                            st.execute((new StringBuilder()).append("update TBLBCN set REMARK = REMARK & ' ' & '").append(a).append("' WHERE [PART#] = '").append(b).append("';").toString());
//                        } catch (SQLException er) {
//                        }
//                    }
//
//            } catch (SQLException e) {
//                e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
//            }
//        } catch (ClassNotFoundException e) {
//            e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
//        } catch (SQLException e) {
//            e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
//        }
//    }
//}